package Game;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.util.ArrayList;

public abstract class Entity {
 public double x;
 public double y;
 protected Sprite sprite;
 protected double dx;
 protected double dy;
 protected int ID;
 boolean left,right,up,down,collision;
 protected boolean exists;
 	/**
	 * 0=non existent
	 * 1=soft
	 * 2=not soft
	 * 3=not hard
	 * 4=hard
	 */
 protected int hardness=1;
 private Rectangle me;
 	/**
 	 * 
 	 * @param ref
 	 * @param x
 	 * @param y
 	 */
 	public Entity(Sprite sprite,int ID,int x,int y){
 		this.sprite = sprite;
 		this.ID=ID;
 		this.x = x;
 		this.y = y;
 		me = new Rectangle(getX(),getY(),sprite.getWidth(),sprite.getHeight());
 	}
 	public boolean getExists(){
		return exists;
	}
 	public void setSprite(Sprite newSprite,int NewID){
 		this.sprite=newSprite;
 		this.ID=NewID;
 	}
 	public int getID(){
 		return ID;
 	}
 	public Rectangle getMe(){
 		me = new Rectangle(getX(),getY(),sprite.getWidth(),sprite.getHeight());
 		return me;
 	}
 	protected long delta=800;
 	public void setDelta(long delta){
 		this.delta=delta;
 	}
 	public void move(){
		this.x += ((delta*dx)/1000);
		this.y += ((delta*dy)/1000);
 	}
 	/**Set the horizontal movement*/
 	public void setHorMove(double dx){
 		this.dx = dx;
 	}
 	/**Set the Vertical movement*/
 	public void setVerMove(double dy){
 		this.dy = dy;
 	}
 	/**Get the horizontal movement*/
 	public double getHorMove(){
 		return dx;
 	}
 	/**Get the Vertical movement*/
 	public double getVerMove(){
 		return dy;
 	}
 	public int getXBound(){
 		return sprite.getWidth();
 	}
 	public int getYBound(){
 		return sprite.getHeight();
 	}
 	public Sprite getSprite(){
 		return sprite;
 	}
 	public void Draw(Graphics g,int index,int nx,int ny){
 		if(index+1>sprite.getSize())
 			index=sprite.getSize()-1;
 		sprite.Draw(g,(int) x-nx,(int) y-ny,index);
 	}
 	/**
 	 * 0=nothing
 	 * 1=slow walk
 	 * 2=soft
 	 * 3=hard weak
 	 * 4=hard
 	 * @param Hardness
 	 */
 	public void setHardness(int hardness){
 		this.hardness=hardness;
 	}
 	public int getX(){
 		return (int) x;
 	}
 	public int getY(){
 		return (int) y;
 	}
 	public void kill(){
 		exists=false;
 	}
 }